<template>
  <!-- 雷达图  图表必须给高和宽度-->
  <div ref="myDiv" class="radar-echart" />
</template>

<script>
// import echarts from 'echarts'
var echarts = require('echarts/lib/echarts') // 引入echarts主模块
require('echarts/lib/chart/radar') // 引入雷达图
// 引入提示框和标题组件
require('echarts/lib/component/tooltip')
require('echarts/lib/component/title')
export default {
  mounted() {
    const myEchart = echarts.init(this.$refs.myDiv) // 初始化图表
    myEchart.setOption({
      title: {
        text: '个人工作绩效表'
      },
      legend: {
        data: ['Allocated Budget', 'Actual Spending']
      },
      radar: {
        // shape: 'circle',
        indicator: [
          { name: '考勤', max: 100 },
          { name: '工资', max: 100 },
          { name: '代码质量', max: 100 },
          { name: '工作积极性', max: 100 },
          { name: '加班时长', max: 100 },
          { name: 'bug数量', max: 100 }
        ]
      },
      series: [
        {
          name: 'Budget vs spending',
          type: 'radar',
          data: [
            {
              value: [3, 100, 100, 0, 0, 0],
              name: '张三'
            },
            {
              value: [100, 20, 30, 100, 100, 100],
              name: '李四'
            }
          ]
        }
      ]
    })
  }
}
</script>

<style>
.radar-echart {
  width: 600px;
  height: 400px;
}
</style>
